package day14;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class TestGeneric1 {
	public static void main(String[] args) {
		ArrayList<String> al = new ArrayList<String>();
		al.add("aaa");
		//al.add(1);
		al.add("bbb");
		//String s = al.get(0);
		al.add("ccc");
		Iterator<String> it = al.iterator();
		while(it.hasNext()){
			String s = it.next();
			System.out.println(s);
		}
		List<Integer> list = new ArrayList<Integer>();
		list.add(1);
		list.add(2);
		//list.add("3");
		for (Iterator<Integer> it1 = list.iterator(); it1.hasNext();) {
			Integer i =  it1.next();
			System.out.println(i);
		}
		Map<Integer, String> m = new HashMap<Integer, String>();
		m.put(1, "aaa");
		m.put(2, "bbb");
		Set<Map.Entry<Integer, String>>  s = m.entrySet();
		Iterator<Map.Entry<Integer, String>> it2 = s.iterator();
		while(it2.hasNext()){
			Map.Entry<Integer, String> me = it2.next();
			Integer key = me.getKey();
			String value = me.getValue();
			System.out.println(key+":"+value);
		}
		Set<Integer> s1 = m.keySet();
		Iterator<Integer> it3 = s1.iterator();
		while(it3.hasNext()){
			Integer key = it3.next();
			String value = m.get(key);
			System.out.println(key+":"+value);
		}
		
	/*	Set<Object> set = new HashSet<String>();
		set.add("dsfa");
		set.add(1);*/
		Set<Number> set = new HashSet<Number>();
		set.add(1);
		set.add(1.1);
		set.add(1L);
		set.add(new Short("10"));
		//Set set1 = new HashSet();//Set<Object> set1 = new HashSet<Object>();
		List<Comparable/*<String>*/> list1 = new ArrayList<Comparable/*<String>*/>();
		list1.add("aaaa");
		list1.add(1);
		list1.add(1.2);
	}
}

class TeacherComparator implements Comparator<Teacher>{
	public int compare(Teacher o1, Teacher o2) {
		return o1.getAge()-o2.getAge();
	}
}









